/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pa165.dominatingspecies.rest;

import pa165.dominating.species.enums.ElementType;
import static pa165.dominating.species.enums.ElementType.BUSH;
import static pa165.dominating.species.enums.ElementType.EVERGREEN;
import static pa165.dominating.species.enums.ElementType.GRASS;
import static pa165.dominating.species.enums.ElementType.JUNGLE_TREE;
import static pa165.dominating.species.enums.ElementType.MUD;
import static pa165.dominating.species.enums.ElementType.PEBBLESTONE;
import static pa165.dominating.species.enums.ElementType.SALT_WATER;
import static pa165.dominating.species.enums.ElementType.SAND;
import static pa165.dominating.species.enums.ElementType.SNOW;
import static pa165.dominating.species.enums.ElementType.SOIL;
import static pa165.dominating.species.enums.ElementType.STONE;
import static pa165.dominating.species.enums.ElementType.TREE;
import static pa165.dominating.species.enums.ElementType.WATER;

/**
 *
 * @author Ondrej Prazak
 */
public class EnumConverter {
    public ElementType string2Enum(String selected) {
        if (selected == null) {
            return null;
        }
        ElementType converted = null;
        switch (selected) {
            case "water":
                converted = ElementType.WATER;
                break;
            case "salt water":
                converted = ElementType.SALT_WATER;
                break;
            case "mud":
                converted = ElementType.MUD;
                break;
            case "sand":
                converted = ElementType.SAND;
                break;
            case "pebblestone":
                converted = ElementType.PEBBLESTONE;
                break;
            case "soil":
                converted = ElementType.SOIL;
                break;
            case "stone":
                converted = ElementType.STONE;
                break;
            case "grass":
                converted = ElementType.GRASS;
                break;
            case "bush":
                converted = ElementType.BUSH;
                break;
            case "evergreen":
                converted = ElementType.EVERGREEN;
                break;
            case "tree":
                converted = ElementType.TREE;
                break;
            case "jungle tree":
                converted = ElementType.JUNGLE_TREE;
                break;
            case "snow":
                converted = ElementType.SNOW;
                break;

        }
        return converted;
    }

    public String enum2String(ElementType selected) {
        if (selected == null) {
            return "";
        }
        String converted = null;
        switch (selected) {
            case WATER:
                converted = "water";
                break;
            case SALT_WATER:
                converted = "salt water";
                break;
            case MUD:
                converted = "mud";
                break;
            case SAND:
                converted = "sand";
                break;
            case PEBBLESTONE:
                converted = "pebblestone";
                break;
            case SOIL:
                converted = "soil";
                break;
            case STONE:
                converted = "stone";
                break;
            case GRASS:
                converted = "grass";
                break;
            case BUSH:
                converted = "bush";
                break;
            case EVERGREEN:
                converted = "evergreen";
                break;
            case TREE:
                converted = "tree";
                break;
            case JUNGLE_TREE:
                converted = "jungle tree";
                break;
            case SNOW:
                converted = "snow";
                break;

        }
        return converted;
    }
    
    public String[] allEnumsAsStrings(){
        String[] arr = {"water","salt water","mud","sand","pebblestone", "soil", "stone", "grass", "bush", "evergreen", "tree", "jungle tree", "snow"}; 
        return arr;
    } 
}
